import sys, os

class Notipy(object):
    '''
    Extend this class tu create your own behaviour
    '''


    def __init__(self, path):
        try:
            if not os.path.isdir(path):
                raise Exception(path + " is not a valid directory")
        except Exception as exp:
                exit(exp)
        
        if sys.platform == "linux2":
            import OnLinux
            OnLinux.StartWatching(self, path)
        elif sys.platform == "windows":
            import OnWindows
            OnWindows.startWatch(self, path)
            
    def event_file_new(self,path):
        print "[event_file_new] : "+ path
        
    def event_file_modified(self,path):
        print "[event_file_modified] : "+ path
        
    def event_file_deleted(self,path):
        print "[event_file_deleted] : "+ path
    
    def event_file_moved(self,source,path):
        print "[event_file_moved] : FROM " + source + " TO " + path
        
    def event_dir_new(self,path):
        print "[event_dir_new] : "+ path
        
    def event_dir_modified(self,path):
        print "[event_dir_modified] : "+ path
        
    def event_dir_deleted(self,path):
        print "[event_dir_deleted] : "+ path
    
    def event_dir_moved(self,source,path):
        print "[event_dir_moved] : FROM " + source + " TO " + path

if __name__ == "__main__":
    if len(sys.argv) > 0:
        dir = sys.argv[1]
    else:
        dir = "/tmp"
    n = Notipy(dir)  

